<template>
  <div>
    <div class="home-top" ref="top" style="border:0;"> 
      <mt-header title="我的消息">
        <mt-button icon="back" @click='$router.back(-1)' slot="left"></mt-button>
      </mt-header> 
    </div>
    <div ref="block"></div>
    <ul class="message-list">
      <li v-for="(item,index) in list">
        <div class="message-item-in"> 
          <div class="message-item-c">
            <div class="f16">{{getType(item.type)}}</div>
            <p class="mt10 f14">{{item.text}}</p>
          </div>
          <mt-button type="danger" size="small" plain @click="removeItem(item.id)">删除</mt-button>
        </div>
      </li>
    </ul> 
    <div class="no-more" v-show="!hasMore">没有更多…</div> 
  </div>
</template>

<script>
export default {
  data () {
    return {
      selected:"1",
      loading:false,
      hasMore:false,
      list:[]
    }
  },
  mounted(){    
    var t_h = this.$refs.top.offsetHeight;
    this.$refs.block.style.height = t_h + "px";
    this.getList();
  },
  methods:{
    getList(){
      this.list = [
        {
          id:"1",
          type:1,
          text:"岳麓区俱乐部已经通过您加入的申请！"
        },
        {
          id:"2",
          type:2,
          text:"芙蓉区俱乐部已经拒绝您加入的申请！"
        }
      ];
    },
    getType(n){
      var str = "";
      if(n == 1){
        str = "申请通过";
      }else if(n == 2){
        str = "申请拒绝"
      }
      return str;
    },
    removeItem(id){
      this.$messagebox.confirm('<i style="color:#000;">您确定删除该搭档吗？</i>',null).then(action => {
        if(action == 'confirm'){
          this.$toast('删除搭档成功！');
        }
      });
    }
  }
}
</script>
